# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
===========================
@Time : 2022/10/30 0030 9:09
@Author : 测试开发工程师
@File : conftest.py
@Software: PyCharm
============================
"""
import os.path
import time

import pytest


# pytest 可以直接获取 rootdir 路径
def get_rootdir(request):
    # 根目录
    rootdir = request.config.rootdir
    return rootdir


@pytest.fixture(scope="session", autouse=True)
def manage_logs(request):
    now = time.strftime("%Y-%m-%d %H-%M-%S")
    log_name = 'logs/' + now + '.logs'

    request.config.pluginmanager.get_plugin('logging-plugin').set_log_path(os.path.join(request), log_name)
